home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_aet_rotate.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  150 lines

  1. # Jones 3D Cog Script
  2. #
  3. # aet_Rotate.cog
  4. #
  5. # [RKD] [TL]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. #
  9. # ========================================================================================
  10. symbols
  11.  
  12. message    startup
  13. message    arrived
  14. message    entered
  15. message    exited
  16.  
  17. thing    gear0                        # Rings that rotate.
  18. thing    gear1
  19. thing    gear2
  20. thing    ghost0                        # Ghosts to teleport the rings to to reset pos.
  21. thing    ghost1
  22. thing    ghost2
  23.  
  24. sector    northSec0        linkid=2    # Sectors to trigger to open the rings in a certain direction.
  25. sector    southSec0        linkid=2
  26. sector    eastSec0        linkid=4
  27. sector    westSec0        linkid=4
  28.  
  29. sound    snd=aet_ring_spin.wav    local
  30.  
  31. flex    speed=1.0
  32. flex    speedstop=1.0    
  33. int        nsInt=0            local        # Ints to show which sectors Indy has triggered.
  34. int        ewInt=0            local
  35. int        done0=0            local        # Int to make sure he doesn't trigger multiple times.
  36. int        looping            local        
  37.  
  38. end
  39.  
  40. # ========================================================================================
  41. code
  42.  
  43. startup:
  44.  
  45. # No collision on rings.
  46. SetCollideType(gear0, 0);
  47. SetCollideType(gear1, 0);
  48. SetCollideType(gear2, 0);
  49. # Begin rotation on rings.
  50. Rotate(gear0, 360, 0, speed);
  51. Rotate(gear1, 360, 2, speed);
  52. Rotate(gear2, 360, 1, speed);
  53. # Start looping sound.
  54. Sleep(0.01);
  55. # Playing sound on rings.
  56. looping = PlaySoundThing(snd, ghost0, 1.0, 7.0, 15.0, 0x881);
  57. ChangeSoundPitch(looping, 0.1, 0.01);
  58.  
  59. return;
  60.  
  61. #........................................................................................
  62. arrived:
  63.  
  64. if (GetSenderRef() == gear0)
  65.     {
  66.     if (done0 == 1) return;
  67.     # If north or south sector triggered...then rotate as such.
  68.     if (nsInt == 1) 
  69.         {
  70.         TeleportThing(gear0, ghost0);
  71.         Rotate(gear0, 90, 0, speedstop);
  72.         TeleportThing(gear1, ghost1);
  73.         Rotate(gear1, 90, 0, speedstop);
  74.         TeleportThing(gear2, ghost2);
  75.         Rotate(gear2, 90, 1, speedstop);
  76.         done0 = 1;    
  77.         return;
  78.         }
  79.     # If east or west sector triggered...then rotate as such.
  80.     if (ewInt == 1) 
  81.         {
  82.         TeleportThing(gear0, ghost0);
  83.         Rotate(gear0, 90, 2, speedstop);
  84.         TeleportThing(gear1, ghost1);
  85.         Rotate(gear1, 90, 2, speedstop);
  86.         TeleportThing(gear2, ghost2);
  87.         Rotate(gear2, 90, 0, speedstop);
  88.         done0 = 1;    
  89.         return;
  90.         }
  91.     # General rotation code.  Teleport is to make sure the rings don't wander.
  92.     TeleportThing(gear0, ghost0);
  93.     Rotate(gear0, 360, 0, speed);
  94.     TeleportThing(gear1, ghost1);
  95.     Rotate(gear1, 360, 2, speed);
  96.     TeleportThing(gear2, ghost2);
  97.     Rotate(gear2, 360, 1, speed);
  98.     }
  99.  
  100. return;
  101.  
  102. #........................................................................................
  103. entered:
  104.  
  105. # Code to trigger rings to stop.
  106. if (GetSenderID() == 2)
  107.     {
  108.     nsInt = 1;
  109.     }
  110. if (GetSenderID() == 4)
  111.     {
  112.     ewInt = 1;
  113.     }
  114.  
  115. return;
  116.  
  117. #........................................................................................
  118. exited:
  119.  
  120. # Code to start them up again.
  121. if (GetSenderID() == 2)
  122.     {
  123.     if (done0 == 1) 
  124.         {
  125.         Rotate(gear0, 90, 0, speed);
  126.         Rotate(gear1, 90, 0, speed);
  127.         Rotate(gear2, 90, 1, speed);
  128.         done0 = 0;
  129.         nsInt = 0;
  130.         return;
  131.         }
  132.     }
  133. if (GetSenderID() == 4)
  134.     {
  135.     if (done0 == 1) 
  136.         {
  137.         Rotate(gear0, 90, 2, speed);
  138.         Rotate(gear1, 90, 2, speed);
  139.         Rotate(gear2, 90, 0, speed);
  140.         done0 = 0;
  141.         ewInt = 0;
  142.         return;
  143.         }
  144.     }
  145. return;
  146.  
  147. #........................................................................................
  148. end
  149.  
  150.